const px2rem = require('postcss-px2rem')
const path = require('path')
function resolve(dir ){
    return path.join(__dirname,dir)
}
module.exports = {
    configureWebpack:{
        resolve:{
            alias:{
                "@":resolve('src'), //@指向src
            },
            extensions:['.js','.vue','.json']
        }
    },
    //是否使用模板编译器，默认值为false
    runtimeCompiler: true,
    //关闭eslint语法检查
    lintOnSave: false,
    css: {
        requireModuleExtension: true,
        sourceMap: true,
        loaderOptions: {
            stylus:{
                rules: [
                    {
                        test: /\.styl$/,
                        loader: "stylus-loader", // compiles Styl to CSS
                    }
                ]
            },
            postcss:{
                plugins:[
                    px2rem({
                        remUnit:37.5 //设计稿计算出来后的rem值 375/10
                    })
                ]
            }

        }
    },
    devServer:{
        proxy: {
            '/api': {
                target: 'http://localhost:4000',
                ws: true,//代理webscokets
                changeOrigin: true,//支持跨域
                pathRewrite:{
                    '^/api':''
                }
            }
        }
    }
}